<?php include ("header.php"); ?>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
    function submit_detail() {
        $('#form_agent').attr('action','detailstunnel.php');
        $('#form_agent').submit();
    }
    function submit_histo() {
        $('#form_agent').attr('action','historique.php');
        $('#form_agent').target = "_blank" ;
        $('#form_agent').submit();
    }
    function submit_signaler() {
        $('#form_agent').attr('action','signalerincident.php');
        $('#form_agent').target = "_blank" ;
        $('#form_agent').submit();
    }
</script>

<div id="titre">
    <h2><p align="center"> Liste Tunnels </p></h2>
</div>
<?php 
$base = new Connect_bdd('localhost','rtgs','root','');
$req = 'SELECT id_tunnel,nom FROM Tunnel';
$tab = $base->select($req); 
$i=0;
?>
<form  method="post" id="form_agent" name="form_agent" action="">
    <table id="tableau" cellspacing="0">
        <caption>Liste des Tunnels associ&eacute;</caption>
        <p></p>
        <tr>
        <th scope="col">Nom Tunnel</th>
        </tr>
        <?php
        foreach ($tab as $value) { ?>
        <tr>
        <td <?php if($i%2) echo 'class="alt"'; ?> ><?php echo $value['nom'];?> <input type="radio" name="tunnel" value=<?php echo $value["id_tunnel"]; ?> > </td>
        </tr>
        <?php  $i++; }; ?>
    </table>
    <p></p>
</form>    
<div class="input">
    <input type="submit" value="D&eacute;tails Tunnel" ONCLICK="submit_detail()" style="height: 26px; width: 141px">&nbsp;&nbsp;&nbsp;
    <input type="button" value="Historique Signalisations" ONCLICK="submit_histo()" style="height: 26px; width: 173px">&nbsp;&nbsp;&nbsp;
    <input type="button" value="Signaler Incident" ONCLICK="submit_signaler()" style="height: 26px; width: 184px">
</div>
<?php include("footer.php"); ?>